<template>
  <div class="home" :style="{ zoom: zoom }">
    <Header />
    <MapView @onTunnelIdEvent="getWidHandler" />
    <div class="main-data">
      <div class="data-left">
        <PieChart />
        <EarlyWarning />
        <ConstructionProgress />
      </div>
      <div class="data-center">
        <div class="data-center-bottom">
          <div class="left">
            <Qualified />
          </div>
          <div class="right">
            <WallRock />
          </div>
        </div>
      </div>
      <div class="data-right">
        <Measurement />
        <Forecast />
        <GeologyForecast />
      </div>
    </div>
  </div>
</template>

<script>
import PieChart from "./bigdata/pie-chart.vue";
import EarlyWarning from "./bigdata/early-warning.vue";
import ConstructionProgress from "./bigdata/construction-progress.vue";
import GeologyForecast from "./bigdata/geology-forecast.vue";
import Forecast from "./bigdata/forecast.vue";
import Measurement from "./bigdata/measurement.vue";
import Qualified from "./bigdata/qualified.vue";
import MapView from "./bigdata/map.vue";
import WallRock from "./bigdata/wall-rock.vue";
import Header from "./bigdata/header.vue";
export default {
  name: "",
  components: {
    Header,
    WallRock,
    MapView,
    Qualified,
    Measurement,
    PieChart,
    EarlyWarning,
    ConstructionProgress,
    GeologyForecast,
    Forecast,
  },
  data() {
    return {
      option: {},
      zoom: 1,
      percentage: 20,
      customColor: "#00FCFF",
      colors: "#00FCFF",
      // 隧道id
      tunnelId: 5,
    };
  },
  created() {
    const _this = this;
    _this.zoom = _this.pxzoom().zoom;
  },
  mounted() {
    const _this = this;
    window.addEventListener("resize", () => {
      _this.zoom = _this.pxzoom().zoom;
    });
    this.getData(this.tunnelId)
  },
  methods: {
    getWidHandler(data) {
      this.getData(data)
    },
    getData(tunnelid) {
      // 施工进度
      this.$bus.$emit("construction-progress", tunnelid);
      // 预警信息
      this.$bus.$emit("early-warning", tunnelid);
      // 合格率
      this.$bus.$emit("qualified", tunnelid);
      // 围岩等级断面占比
      this.$bus.$emit("wallrockweiyan", tunnelid);
      // 施工监控量测工作进展
      this.$bus.$emit("measurement", tunnelid);
      // 超前地质预报工作进展
      this.$bus.$emit("forecast", tunnelid);
      // 施工质量检测工作进展
      this.$bus.$emit("cgeology-forecast", tunnelid);
    },
  },
};
</script>


<style lang="scss">
*::-webkit-scrollbar {
  width: 6px !important;
  height: 14px !important;
}

*::-webkit-scrollbar-thumb {
  width: 6px !important;
  height: 14px !important;
  border-radius: 10px !important;
  background-color: rgba($color: #65e2be, $alpha: 0.39) !important;
}
</style>

<style lang="scss" scoped>
.home {
  width: 100%;
  min-width: 1600px;
  height: 100%;
  overflow: hidden;
  position: relative;
  left: 0;
  top: 0;
  padding-top: 80px;
  box-sizing: border-box;
  background-image: url(../../assets/bg.png);
  display: flex;
  flex-direction: column;
  > .main-data {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 20px;
    display: flex;
    justify-content: space-between;

    .data-left {
      width: 22%;
      height: 100%;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }

    .data-right {
      width: 22%;
      height: 100%;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }

    .data-center {
      width: 56%;
      height: 293px;
      padding: 0 10px;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      position: absolute;
      bottom: 0;
      left:22%;

      // .data-center-top {
      //   width: 100%;
      //   flex: 1;
      // }

      .data-center-bottom {
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;

        > .left {
          width: 65%;
          height: 100%;
          display: flex;
          align-items: flex-end;
        }

        > .right {
          flex: 1;
          height: 100%;
          margin-left: 12px;
          display: flex;
          align-items: flex-end;
        }
      }
    }
  }
}
</style>
